package com.alpha.eceasy.mall.api.entity;

import com.alpha.eceasy.extension.BaseFormInfo;
import com.alpha.eceasy.mall.api.dto.MallOrderDTO;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serial;
import java.time.LocalDate;

/**
 * 支付订单详情
 *
 * @author medical
 * @since 2019-05-28 23:57:58
 */
@Data
@TableName("mall_order_detail")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "支付订单详情")
@AllArgsConstructor
@NoArgsConstructor
public class MallOrderDetail extends BaseFormInfo<MallOrderDetail> {
    @Serial
    private static final long serialVersionUID = 641655770L;
	@Schema(description =  "支付订单编码")
	private String orderGuid;
	@Schema(description =  "商品规格id")
	private String commoditySpecificationGuid;
	@Schema(description =  "商品数量")
	private Integer number;
	@Schema(description =  "期望采购单价")
	private String expectedPurchasePrice;
	@Schema(description =  "交付周期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
	private LocalDate deliveryCycle;

	public MallOrderDetail(MallOrderDTO dto) {
		BeanUtils.copyProperties(dto, this);
	}
}
